package middleware

import (
	"github.com/gofiber/fiber/v3"
)

// Protected protect routes
func Protected() fiber.Handler {
	return func(ctx fiber.Ctx) error {
		return nil
	}
}

func jwtError(c fiber.Ctx, err error) error {
	if err.Error() == "Missing or malformed JWT" {
		return c.Status(fiber.StatusBadRequest).
			JSON(fiber.Map{"status": "error", "message": "Missing or malformed JWT", "data": nil})
	}
	return c.Status(fiber.StatusUnauthorized).
		JSON(fiber.Map{"status": "error", "message": "Invalid or expired JWT", "data": nil})
}
